﻿using Bouyei.GeoCore.Converters;
using Bouyei.GeoCore.Geometries;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Bouyei.GeoCore.GeoParsers
{
    public class BaseBytes : IBase
    {
        protected byte[] Buffer = null;
        protected int Offset = 0;
        protected ByteOrder ByteOrder;
        protected BitExtensions bitExt = null;

        public BaseBytes() { }

        public BaseBytes(byte[] buffer, int offset = 0)
        {
            this.Buffer = buffer;
            this.Offset = offset;
            ByteOrder = (ByteOrder)buffer[offset];

            bitExt = new BitExtensions(ByteOrder);
        }

        public BaseBytes(byte[] buffer, ByteOrder byteOrder, int offset = 0)
        {
            this.Buffer = buffer;
            this.Offset = offset;
            this.ByteOrder = byteOrder;

            bitExt = new BitExtensions(byteOrder);
        }

        public virtual void Dispose()
        {
            if (Buffer != null)
                Buffer = null;
        }
    }
}
